import request from '@/utils/request'

// 查询跟进记录列表
export function listRecord(query) {
  return request({
    url: '/crm/record/list',
    method: 'get',
    params: query
  })
}

// 查询跟进记录详细
export function getRecord(id) {
  return request({
    url: '/crm/record/' + id,
    method: 'get'
  })
}

// 新增跟进记录
export function addRecord(data) {
  return request({
    url: '/crm/record',
    method: 'post',
    data: data
  })
}

// 修改跟进记录
export function updateRecord(data) {
  return request({
    url: '/crm/record',
    method: 'put',
    data: data
  })
}

// 删除跟进记录
export function delRecord(id) {
  return request({
    url: '/crm/record/' + id,
    method: 'delete'
  })
}

// 查询详细客户信息
export function getCustomerInfo(customerName) {
  return request({
    url: '/crm/customer/customer/' + customerName,
    method: 'get'
  })
}

// 查询详细的跟进记录
export function getFollowRecord(customerName) {
  return request({
    url: '/crm/record/name/' + customerName,
    method: 'get'
  })
}

// 查询联系人的详细信息
export function getContact(customerName) {
  return request({
    url: '/crm/person/contact/' + customerName,
    method: 'get'
  })
}


// 根据联系人姓名查询联系人的详细信息
export function getContactByTelName(telName) {
  return request({
    url: '/crm/person/contact/telname/' + telName,
    method: 'get'
  })
}

// 获取公司首要联系人的详细信息
export function getFirstContactInfoByCustomerName(customerName) {
  return request({
    url: '/crm/person/contact/first/' + customerName,
    method: 'get'
  })
}
